package com.ruoyi.backend.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.backend.mapper.SysUserRealAuthMapper;
import com.ruoyi.backend.domain.SysUserRealAuth;
import com.ruoyi.backend.service.ISysUserRealAuthService;

/**
 * 实名认证Service业务层处理
 * 
 * @author wjr
 * @date 2025-09-23
 */
@Service
public class SysUserRealAuthServiceImpl implements ISysUserRealAuthService 
{
    @Autowired
    private SysUserRealAuthMapper sysUserRealAuthMapper;

    /**
     * 查询实名认证
     * 
     * @param id 实名认证主键
     * @return 实名认证
     */
    @Override
    public SysUserRealAuth selectSysUserRealAuthById(Integer id)
    {
        return sysUserRealAuthMapper.selectSysUserRealAuthById(id);
    }

    /**
     * 查询实名认证列表
     * 
     * @param sysUserRealAuth 实名认证
     * @return 实名认证
     */
    @Override
    public List<SysUserRealAuth> selectSysUserRealAuthList(SysUserRealAuth sysUserRealAuth)
    {
        return sysUserRealAuthMapper.selectSysUserRealAuthList(sysUserRealAuth);
    }

    /**
     * 新增实名认证
     * 
     * @param sysUserRealAuth 实名认证
     * @return 结果
     */
    @Override
    public int insertSysUserRealAuth(SysUserRealAuth sysUserRealAuth)
    {
        sysUserRealAuth.setCreateBy(SecurityUtils.getUsername());
        sysUserRealAuth.setCreateTime(DateUtils.getNowDate());
        return sysUserRealAuthMapper.insertSysUserRealAuth(sysUserRealAuth);
    }

    /**
     * 修改实名认证
     * 
     * @param sysUserRealAuth 实名认证
     * @return 结果
     */
    @Override
    public int updateSysUserRealAuth(SysUserRealAuth sysUserRealAuth)
    {
        sysUserRealAuth.setUpdateBy(SecurityUtils.getUsername());
        sysUserRealAuth.setUpdateTime(DateUtils.getNowDate());
        return sysUserRealAuthMapper.updateSysUserRealAuth(sysUserRealAuth);
    }

    /**
     * 批量删除实名认证
     * 
     * @param ids 需要删除的实名认证主键
     * @return 结果
     */
    @Override
    public int deleteSysUserRealAuthByIds(Integer[] ids)
    {
        return sysUserRealAuthMapper.deleteSysUserRealAuthByIds(ids);
    }

    /**
     * 删除实名认证信息
     * 
     * @param id 实名认证主键
     * @return 结果
     */
    @Override
    public int deleteSysUserRealAuthById(Integer id)
    {
        return sysUserRealAuthMapper.deleteSysUserRealAuthById(id);
    }

    /**
     * 审核实名认证
     *
     * @param sysUserRealAuth 实名认证
     * @return 结果
     */
    @Override
    public int auditRealAuth(SysUserRealAuth sysUserRealAuth)
    {
        //设置审核人审核时间
        sysUserRealAuth.setAuditBy(SecurityUtils.getUsername());
        sysUserRealAuth.setAuditTime(DateUtils.getNowDate());

        sysUserRealAuth.setUpdateBy(SecurityUtils.getUsername());
        sysUserRealAuth.setUpdateTime(DateUtils.getNowDate());
        return sysUserRealAuthMapper.updateSysUserRealAuth(sysUserRealAuth);
    }

}
